<?php

abstract class Links_Utils 
{
    
    /**
    * Filter name.
    * 
    */
    const FILTER = 'category';
    
    /**
    * List of the filters
    * 
    * @return array
    */
    static public function filtersList() 
    {
        static $cach;
        
        if (is_null($cach)) {
            $query = '
                SELECT 
                       `id`, 
                       `name` 
                  FROM 
                       `links_categories` 
              ORDER BY 
                       `position` ASC
                ';
            $cach = database::fetchPairs($query);
        }
        
        return $cach;
    }
    
    /**
    * Active filter
    * 
    * @return integer
    */
    static public function activeFilter() 
    {
        return (int)Application::getRequest()->get(self::FILTER, key(self::filtersList()));
    }
    
}